var gulp = require('gulp'),
    minifyCSS = require('gulp-minify-css'),
    sass = require('gulp-sass'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    concat = require('gulp-concat')

gulp.task('css', function () {
    gulp.src('assets/**/*.css')
        .pipe(minifyCSS())
        .pipe(gulp.dest('./_build/'))
    // .pipe(rename({ suffix: '.min' }))
    // .pipe(minifyCSS())
    // .pipe(gulp.dest('./_build/min/'))
});
gulp.task('script', function() {
    gulp.src('assets/**/*.js')
        .pipe(uglify())
        .pipe(gulp.dest('./_build/'))
})

gulp.task('sass', function() {
    gulp.src('./assets/**/*.scss')
        .pipe(sass())
        .pipe(gulp.dest('./assets/'));
});

gulp.task('default', function(){
    gulp.run('sass', 'css', 'script');
    gulp.watch(['assets/**/*.scss','assets/**/*.js'], function(){
        gulp.run('sass','css', 'script');
    });
});